package com.dyd.smco.db.domain;

import com.baomidou.mybatisplus.annotation.*;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 文件存储表
 * </p>
 *
 * @author dyd
 * @since 2025-08-08
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("smart_community_storage")
public class SmartCommunityStorage implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 文件存储表ID
     */
    @TableId("id")
    private String id;

    /**
     * 文件的唯一索引
     */
    @TableField("`key`")
    private String key;

    /**
     * 文件名
     */
    @TableField("`name`")
    private String name;

    /**
     * 文件类型
     */
    @TableField("`type`")
    private String type;

    /**
     * 文件大小
     */
    @TableField("size")
    private Integer size;

    /**
     * 文件访问链接
     */
    @TableField("url")
    private String url;

    /**
     * 创建时间
     */
    @TableField(value = "add_time", fill = FieldFill.INSERT)
    private LocalDateTime addTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 逻辑删除
     */
    @TableField("deleted")
    @TableLogic
    private Boolean deleted;

    /**
     * 租户ID，用于分割多个租户
     */
    @TableField("tenant_id")
    private String tenantId;

    /**
     * 更新版本号
     */
    @TableField("version")
    @Version
    private Integer version;

    public static final String ID = "id";

    public static final String KEY = "key";

    public static final String NAME = "name";

    public static final String TYPE = "type";

    public static final String SIZE = "size";

    public static final String URL = "url";

    public static final String ADD_TIME = "add_time";

    public static final String UPDATE_TIME = "update_time";

    public static final String DELETED = "deleted";

    public static final String TENANT_ID = "tenant_id";

    public static final String VERSION = "version";
}
